package com.reremouse.rerebbs.web.mb;

import com.reremouse.rerebbs.dao.IBbsTalkDAO;
import com.reremouse.rerebbs.dao.IBbsThreadDAO;
import com.reremouse.rerebbs.dao.IBbsUserDAO;
import com.reremouse.rerebbs.model.BbsTalk;
import com.reremouse.rerebbs.model.BbsThread;
import com.reremouse.rerebbs.model.BbsUser;
import com.reremouse.util.SpringHelper;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
import java.util.List;

@ManagedBean
@ViewScoped
public class UserTalkList
        implements Serializable {
    List<BbsThread> threads;
    List<BbsTalk> talks;
    IBbsUserDAO userDAO = (IBbsUserDAO) SpringHelper.getSpringBean("BbsUserDAO");
    IBbsThreadDAO threadDAO = (IBbsThreadDAO) SpringHelper.getSpringBean("BbsThreadDAO");
    IBbsTalkDAO talkDAO = (IBbsTalkDAO) SpringHelper.getSpringBean("BbsTalkDAO");

    public List<BbsThread> getThreads() {
        return this.threads;
    }

    public void setThreads(List<BbsThread> threads) {
        this.threads = threads;
    }

    public List<BbsTalk> getTalks() {
        return this.talks;
    }

    public void setTalks(List<BbsTalk> talks) {
        this.talks = talks;
    }

    @PostConstruct
    public void init() {
        HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
        String id = request.getParameter("id");
        BbsUser user = this.userDAO.findBbsUser(Long.parseLong(id));
        this.threads = this.threadDAO.findByGenBy(user, new int[]{0, 1000});
        this.talks = this.talkDAO.findByGenBy(user, new int[]{0, 1000});
    }
}



/* Location:           F:\jsp源码\蝙蝠论坛系统\rerebbs\WEB-INF\classes\

 * Qualified Name:     com.reremouse.rerebbs.web.mb.UserTalkList

 * JD-Core Version:    0.7.0.1

 */